package xyz.scootaloo.oj.leetcode;

import java.util.ArrayList;
import java.util.List;

/**
 * 未完成
 * @author flutterdash@qq.com
 * @since 2021/3/29 14:56
 */
public class P18 {

    public List<List<Integer>> fourSum(int[] nums, int target) {
        int len = nums.length;
        List<List<Integer>> res = new ArrayList<>();
        if (len == 0)
            return res;
        for (int a = 0; a<len; a++) {
            for (int b = 0; b<len; b++) {
                if (a == b)
                    continue;
                for (int c = 0; c<len; c++) {
                    if (c == b || c == a)
                        continue;
                    for (int d = 0; d<len; d++) {
                        if (d == a || d == b || d == c)
                            continue;
                        int sum = a + b + c + d;
                        if (sum == target) {
                            List<Integer> rsl = new ArrayList<>(4);
                            rsl.add(a);
                            rsl.add(b);
                            rsl.add(c);
                            rsl.add(d);
                            res.add(rsl);
                        }
                    }
                }
            }
        }
        return res;
    }

    public static void main(String[] args) {
        int[] input_1 = {1, 0, -1, 0, -2, 2};
        System.out.println(new P18().fourSum(input_1, 0));
    }

}
